package com.buaa.controller;

import com.buaa.common.Result;
import com.buaa.entity.Address;
import com.buaa.service.IAddressService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 省市区表 前端控制器
 * </p>
 *
 * @author baomidou
 * @since 2024-06-24
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/address")
public class AddressController {

    private final IAddressService addressService;

    @GetMapping
    public Result<List<Address>> getByPid(@RequestParam("pid") Integer pid) {
        return Result.success(addressService.getAddressByPid(pid));
    }
}
